package com.wxb.qd.common;

/**
 * 返回工具类
 * @author wangxb
 */
public class ResultUtils {
    /**
     * 成功返回状态码0，和success的信息
     * @param data
     * @return
     * @param <T>
     */
    public static <T> BaseResponse<T> success(T data){
        return new BaseResponse<>(0,data,"success");
    }

    public static BaseResponse error(int code,String message){
        return new BaseResponse(code,null,message);
    }

    public static BaseResponse error(ErrorCode errorCode,String message){
        return new BaseResponse(errorCode.getCode(),null,message);
    }
}
